function Z = pp_baugh_wooley(A, B, C)
    len = length(A);
    Z = zeros(len^2, len^2+len-1);
    for i = 1:len,
        for j = 1:len,
            P = A(len-(i-1))*B(len-(j-1))*C;
            s = P(1);
            P(1) = not(P(1));
            if(i == len)
                P = not(P);
            end
            disp('apa:');
            P = [ones(1,len^2+len-i-j)*s P zeros(1,i+j-2)];
            P
            Z(i+j,:) = P;
        end
    end
end